package jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 创建一张表article
 * 表结构
 *  id 整数类型，主键，自增           唯一标识
 *  title 字符串类型，长度200个字符     文章标题
 *  content 字符串类型，长度1000个字符  文章正文
 */
public class Test {
    public static void main(String[] args) {
        try (
                Connection connection = DBUtil.getConnection();
        ){
            String sql = "CREATE TABLE article(" +
                         "  id INT PRIMARY KEY AUTO_INCREMENT," +
                         "  title VARCHAR(200)," +
                         "  content VARCHAR(1000)" +
                         ")";
            Statement statement = connection.createStatement();
            statement.execute(sql);
            System.out.println("表创建完毕!");

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}





